import React, { Component } from 'react';
import {
    Platform,
    StyleSheet,
    Text,
    View,
    TextInput,
    Image,
    TouchableOpacity, Dimensions, NativeModules,
} from 'react-native';
import { Actions } from 'react-native-router-flux';
import { pTd } from "../../util/adapter";
import Button from "../../component/Button"
import CallActionsOnce from "../../util/callActionsOnce"
import DIYIcon from "../../component/Icon";


export default class Login extends Component{

    constructor(props) {
        super(props);
        this.state = {

        };

    }

    handlePressGoLogin=()=>{
        //登录成功跳转
        CallActionsOnce(()=>Actions.replace("_home"))
    }


    render() {

        return <View style={style.container}>
            <View style={style.inputWarp}>
                <View style={style.iconView}><DIYIcon name={'shouji'} size={pTd(26)} color={'#999999'} /></View>
                <TextInput
                    underlineColorAndroid='transparent'
                    style={style.textInput}
                    placeholder="请输入您的手机号码"
                    placeholderTextColor="#999999"
                    selectionColor="#999999"
                    onChangeText={this.onChangeNameValue}
                    value={this.state.nameValue}
                />
            </View>
            <View style={[style.inputWarp,style.inputMargin]}>
                <View style={style.iconView}><DIYIcon name={'iconfontyanzhengma'} size={pTd(26)} color={'#999999'} /></View>
                <TextInput
                    underlineColorAndroid='transparent'
                    style={style.textInput}
                    placeholder="短信验证码"
                    placeholderTextColor="#999999"
                    selectionColor="#999999"
                    onChangeText={this.onChangeNameValue}
                    value={this.state.nameValue}
                />
                <TouchableOpacity activeOpacity={1} onPress={null}  style={style.touchCode}>
                    <Text style={style.codeText}>发送验证码</Text>
                </TouchableOpacity>
            </View>

            <View style={style.buttonWarp}>
                <Button
                    text="登录"
                    ButtonStyles={{backgroundColor: '#FE9727',borderColor:"#FE9727"}}
                    ButtonTextStyles={{fontSize: pTd(32),color: "#ffffff"}}
                    handlePressFunction={()=>this.handlePressGoLogin()}
                />
            </View>
        </View>
    }
}


const style = StyleSheet.create({
    container:{
        flex:1,
        backgroundColor:"#ffffff",
        paddingTop: pTd(100)
    },
    inputWarp:{
        position:'relative',


    },
    textInput:{
        borderBottomColor:"#eeeeee",
        borderStyle:'solid',
        borderBottomWidth: pTd(1),
        marginHorizontal:pTd(100),
        height:pTd(96),
        color:'#333333',
        paddingLeft: pTd(40)
    },
    iconView:{
        left:pTd(100),
        position: 'absolute',
        top:pTd(35)
    },
    inputMargin:{
        marginTop:pTd(40)
    },
    touchCode:{
        right:pTd(100),
        position: 'absolute',
        top:pTd(35)
    },
    codeText:{
        color: "#555555",
        fontSize:pTd(24)
    },
    buttonWarp:{
        marginTop: pTd(140),
        height: pTd(96),
        display: 'flex',
        justifyContent: 'center',
        marginHorizontal:pTd(100),
        alignItems: 'center',
    },
});
